package com.bwie.auth.controller;

import com.bwie.auth.service.AuthService;
import com.bwie.common.domain.User;
import com.bwie.common.domain.request.UserReq;
import com.bwie.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName AuthController
 * @Description 描述
 * @Author ShiYu.Cui
 * @Date 2024/4/25 9:00
 */
@RestController
public class AuthController {
    @Autowired
    private AuthService authService;

    @PostMapping("/login")
    public Result login(@RequestBody UserReq userReq){
        Result result=authService.login(userReq);
        return result;
    }

    @GetMapping("/getInfo")
    public Result<User> getInfo(){
        User user=authService.getInfo();
        Result<User> result=Result.success(user);
        return result;
    }
}
